package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	fileName := "doc/001.txt"
	file, err := os.Open(fileName)
	if err != nil {
		fmt.Printf("open file (%s) error.", fileName)
		return
	}
	defer file.Close()	//关闭文件流
	reader := bufio.NewReader(file)
	for true {
		data, err := reader.ReadString('\n')
		fmt.Printf("data = %s", data)
		if err == io.EOF {
			break
		}
	}

}
